home *** CD-ROM | disk | FTP | other *** search
/ Essentials of Interactive Physiology / Essentials of Interactive Physiology.iso / pc / files / evaluation / evaluationWinIE.dcr / 00002_quizParent.ls < prev    next >
Encoding:
Text File  |  2002-04-02  |  20.8 KB  |  646 lines

  1. property poDotMan, pkMaxDigits, poChapterBtnGroup, poStartBtn, poPrintBtn, poNumQuestionsRadio, poPrev, poTop, poNext, poQuestionTemplate, poRightQuestions, poWrongQuestions, piFirstSummarySprite, piLastSummarySprite, poOwner, psChapterQuestions, plRightWrong, piNumChapters, piNumQuestionsAvailable, piNumQuestions, piNumAnswers, piCurChapter, piCurQuestion, piCurChapterQuestion, piCorrectAnswer, piTotalCorrect, plQuestionsAnswerOrder, plFirstAnswer, pzEvalType, pliChapters, plpTestQuestions, piNumQuestonsAnswered, poPrintEvaluation
  2.  
  3. on new me, xoDotMan, xzEvalType, xzNumQuestions, xiChapter
  4.   poDotMan = xoDotMan
  5.   pzEvalType = xzEvalType
  6.   piNumQuestions = xzNumQuestions
  7.   piCurChapter = xiChapter
  8.   poPrintEvaluation = new(script("printMCEvaluationParent"), me, 6, 1)
  9.   return me
  10. end
  11.  
  12. on mInit me, xInfo
  13.   mInitVars(me, xInfo)
  14.   if not voidp(piCurChapter) then
  15.     pliChapters = [piCurChapter]
  16.     mClearChapterSelection(me)
  17.     mInitQuestions(me)
  18.     mInitNumberFields(me)
  19.     mInitButtons(me, pzEvalType, "prev", "next")
  20.     mSetButtonState(me)
  21.   else
  22.     mInitEvalStart(me)
  23.   end if
  24. end
  25.  
  26. on mInitVars me, xInfo
  27.   piNumQuestionsAvailable = getaProp(xInfo, #numAvailable)
  28.   piNumChapters = getaProp(xInfo, #numChapters)
  29.   piNumAnswers = 4
  30.   pkMaxDigits = 2
  31.   pliChapters = []
  32.   if pzEvalType = #test then
  33.     set the text of field "testRightScroll" to EMPTY
  34.     set the text of field "testWrongScroll" to EMPTY
  35.   end if
  36.   member("fromChapterText").text = EMPTY
  37. end
  38.  
  39. on mInitEvalStart me
  40.   mResetDots(poDotMan)
  41.   mInitBkg(me, string(pzEvalType) & "BG")
  42.   viSprite = mGiveDot(poDotMan)
  43.   poStartBtn = InitPopBtn(me, viSprite, "start" & string(pzEvalType), #mStartBtnClick, VOID, "clickSnd")
  44.   mSetState(poStartBtn, #gray)
  45.   mDisable(poStartBtn, 1)
  46.   viSprite = mGiveDot(poDotMan)
  47.   poPrintBtn = InitPopBtn(me, viSprite, "Print" & string(pzEvalType), #mPrintBtnClick, #clean, "clickSnd")
  48.   mSetState(poPrintBtn, #gray)
  49.   mDisable(poPrintBtn, 1)
  50.   mInitChapterSelectionBtns(me)
  51.   if pzEvalType = #test then
  52.     mInitNumQuestionsRadio(me)
  53.   end if
  54. end
  55.  
  56. on mInitBkg me, xsMember
  57.   viSprite = mGiveDot(poDotMan)
  58.   set the member of sprite viSprite to xsMember
  59. end
  60.  
  61. on mInitButtons me
  62.   case pzEvalType of
  63.     #quiz:
  64.       vsMemberTop = "showAnswer"
  65.     #test:
  66.       vsMemberTop = "doneTest"
  67.   end case
  68.   viSprite = mGiveDots(poDotMan, 3)
  69.   poTop = InitPopBtn(me, viSprite, vsMemberTop, symbol(vsMemberTop), VOID, "clickSnd")
  70.   poPrev = InitPopBtn(me, viSprite + 1, "back", #mPrevBtnClick, VOID, "clickSnd")
  71.   poNext = InitPopBtn(me, viSprite + 2, "next", #mNextBtnClick, VOID, "clickSnd")
  72. end
  73.  
  74. on mInitChapterSelectionBtns me
  75.   case pzEvalType of
  76.     #quiz:
  77.       vsButtonType = "Radio"
  78.     #test:
  79.       vsButtonType = "Toggle"
  80.   end case
  81.   vsMember = string(pzEvalType) & "Circle"
  82.   poChapterBtnGroup = new(script("BtnGroupWLabelParent"), vsButtonType, vsMember, "chapterSpacer", "chapterLabel", poDotMan, piNumChapters, pkMaxDigits)
  83.   mSetOwner(poChapterBtnGroup, me)
  84.   mSetEvent(poChapterBtnGroup, #chapterSelectionClick)
  85. end
  86.  
  87. on mInitNumQuestionsRadio me
  88.   poNumQuestionsRadio = new(script("BtnGroupWLabelParent"), "Radio", string(pzEvalType) & "Circle", "NumQuestionRadioSpacer", "QuestionLabel", poDotMan, 5, pkMaxDigits)
  89.   mSetOwner(poNumQuestionsRadio, me)
  90.   mSetEvent(poNumQuestionsRadio, #numQuestionsRadioBtn)
  91.   mDisable(poNumQuestionsRadio, 0)
  92.   mDepressABtn(poNumQuestionsRadio, 1)
  93. end
  94.  
  95. on mInitReviewQuestionBtns me
  96.   viSprite = mGiveDots(poDotMan, piNumQuestions)
  97.   repeat with i = 1 to piNumQuestions
  98.     vsResult = getAt(plRightWrong, i)
  99.     AlignCenteredSpriteToMember(viSprite + i - 1, "chapSpacer" & IntegerToString(i, pkMaxDigits))
  100.     voQuestionButton = new(script("NotifyOwnerParent"), viSprite + i - 1, "results" & vsResult)
  101.     mSetMyOwnerMyEventMyID(voQuestionButton, me, #questionReview, i)
  102.     set the cursor of sprite (viSprite + i - 1) to 280
  103.     add(the scriptInstanceList of sprite (viSprite + i - 1), voQuestionButton)
  104.   end repeat
  105. end
  106.  
  107. on mInitReviewScrollText me
  108.   viSprite = mGiveDots(poDotMan, 2)
  109.   if the text of field "testRightScroll" = EMPTY then
  110.     vsWrong = EMPTY
  111.     vsRight = EMPTY
  112.     repeat with i = 1 to piNumQuestions
  113.       vsResult = getAt(plRightWrong, i)
  114.       vsLine = "Question " & string(i) & " - Chapter " & string(getPropAt(plpTestQuestions, i))
  115.       if vsResult = "right" then
  116.         vsRight = vsRight & RETURN & vsLine
  117.         next repeat
  118.       end if
  119.       vsWrong = vsWrong & RETURN & vsLine
  120.     end repeat
  121.     delete line 1 of vsRight
  122.     delete line 1 of vsWrong
  123.     member("testWrongScroll").text = vsWrong
  124.     member("testRightScroll").text = vsRight
  125.   end if
  126.   set the member of sprite viSprite to "testRightScroll"
  127.   set the member of sprite (viSprite + 1) to "testWrongScroll"
  128.   member("testRightScroll").rect = member("testRightSpacer").rect
  129.   set the rect of sprite viSprite to member("testRightSpacer").rect
  130.   member("testWrongScroll").rect = member("testWrongSpacer").rect
  131.   set the rect of sprite (viSprite + 1) to member("testWrongSpacer").rect
  132.   AlignTextBoxToSpacer(viSprite, "testRightSpacer")
  133.   AlignTextBoxToSpacer(viSprite + 1, "testWrongSpacer")
  134.   if voidp(poRightQuestions) then
  135.     poRightQuestions = new(script("HotTextFieldParent"), viSprite, 1, me, "testRightScroll")
  136.     poWrongQuestions = new(script("HotTextFieldParent"), viSprite + 1, 2, me, "testWrongScroll")
  137.   end if
  138.   add(the scriptInstanceList of sprite viSprite, poRightQuestions)
  139.   add(the scriptInstanceList of sprite (viSprite + 1), poWrongQuestions)
  140.   mDisable(poRightQuestions, 0)
  141.   mDisable(poWrongQuestions, 0)
  142.   mSetNotifyOnMouseDown(poRightQuestions, 0)
  143.   mSetNotifyOnMouseDown(poWrongQuestions, 0)
  144.   mResetColour(poRightQuestions)
  145.   mResetColour(poWrongQuestions)
  146.   mShow(poRightQuestions)
  147.   mShow(poWrongQuestions)
  148. end
  149.  
  150. on mInitNumberFields me
  151.   viSprite = mGiveDot(poDotMan)
  152.   set the member of sprite viSprite to "question_num"
  153.   member("question_num").text = string(piCurQuestion)
  154.   AlignTextBoxToSpacer(viSprite, "QuestNumSpacer")
  155.   set the ink of sprite viSprite to 36
  156.   viSprite = mGiveDot(poDotMan)
  157.   member("total_questions").text = string(piNumQuestions)
  158.   set the member of sprite viSprite to "total_questions"
  159.   AlignTextBoxToSpacer(viSprite, "TotalQuestionsSpacer")
  160.   set the ink of sprite viSprite to 36
  161.   viSprite = mGiveDot(poDotMan)
  162.   member("total_correct").text = string(piTotalCorrect)
  163.   set the member of sprite viSprite to "total_correct"
  164.   AlignTextBoxToSpacer(viSprite, string(pzEvalType) & "TotalCorrectSpacer")
  165.   set the ink of sprite viSprite to 36
  166. end
  167.  
  168. on mSetButtonState me
  169.   if piCurQuestion = 1 then
  170.     mSetState(poPrev, #gray)
  171.     mDisable(poPrev, 1)
  172.   else
  173.     mSetState(poPrev, #Up)
  174.     mDisable(poPrev, 0)
  175.   end if
  176.   case pzEvalType of
  177.     #test:
  178.       mSetState(poTop, #Up)
  179.       mSetState(poNext, #Up)
  180.       mDisable(poTop, 0)
  181.       mDisable(poNext, 0)
  182.     #quiz:
  183.       if piCurQuestion <= piNumQuestonsAnswered then
  184.         mSetState(poTop, #Up)
  185.         mDisable(poTop, 0)
  186.         mSetState(poNext, #Up)
  187.         mDisable(poNext, 0)
  188.       else
  189.         mSetState(poTop, #gray)
  190.         mDisable(poTop, 1)
  191.         mSetState(poNext, #gray)
  192.         mDisable(poNext, 1)
  193.       end if
  194.   end case
  195. end
  196.  
  197. on mDisable me, xbDisable
  198.   mDisable(poPrev, xbDisable)
  199.   mDisable(poTop, xbDisable)
  200.   mDisable(poNext, xbDisable)
  201. end
  202.  
  203. on mClearChapterSelection me
  204.   mResetDots(poDotMan)
  205.   if not voidp(poStartBtn) then
  206.     mCleanUp(poStartBtn)
  207.     poStartBtn = VOID
  208.     mCleanUp(poChapterBtnGroup)
  209.     poChapterBtnGroup = VOID
  210.   end if
  211.   if not voidp(poNumQuestionsRadio) then
  212.     mCleanUp(poNumQuestionsRadio)
  213.     poNumQuestionsRadio = VOID
  214.   end if
  215. end
  216.  
  217. on mInitQuestions me
  218.   mInitBkg(me, string(pzEvalType) & "QuestBg")
  219.   poQuestionTemplate = new(script("questionParent"), poDotMan, me, piNumAnswers, pzEvalType, pkMaxDigits)
  220.   mInitQuestionTemplate(poQuestionTemplate, string(pzEvalType))
  221.   if voidp(piCurQuestion) then
  222.     mInitQuestionData(me)
  223.     mSelectQuestions(me)
  224.   end if
  225.   mStartNewQuestion(me)
  226.   piNumQuestonsAnswered = 0
  227. end
  228.  
  229. on mInitQuestionData me
  230.   piCurQuestion = 1
  231.   piCurChapterQuestion = 1
  232.   piTotalCorrect = 0
  233.   plRightWrong = []
  234.   plQuestionsAnswerOrder = []
  235.   plFirstAnswer = []
  236.   repeat with i = 1 to piNumQuestions
  237.     setAt(plFirstAnswer, i, 0)
  238.     append(plRightWrong, EMPTY)
  239.     vlAnswerOrder = GetRandomListFrom1toX(piNumAnswers)
  240.     addAt(plQuestionsAnswerOrder, i, duplicate(vlAnswerOrder))
  241.   end repeat
  242.   plAnswerOrder = getAt(plQuestionsAnswerOrder, 1)
  243. end
  244.  
  245. on mSelectQuestions me
  246.   viNumChapters = count(pliChapters)
  247.   viQuestionsPerChapter = integer(piNumQuestions / viNumChapters)
  248.   viRemainder = piNumQuestions - (viQuestionsPerChapter * viNumChapters)
  249.   plpTestQuestions = [:]
  250.   repeat with viChapter in pliChapters
  251.     if getPos(pliChapters, viChapter) <= viRemainder then
  252.       viNumQuestions = viQuestionsPerChapter + 1
  253.     else
  254.       viNumQuestions = viQuestionsPerChapter
  255.     end if
  256.     vsMemberName = IntegerToString(viChapter, 2)
  257.     viNumQuestionsAvailable = the number of lines in the text of member vsMemberName
  258.     vlNumberList = GetListFrom1toX(viNumQuestionsAvailable)
  259.     repeat with i = 1 to viNumQuestions
  260.       viQuestion = random(count(vlNumberList))
  261.       viQuestion = getAt(vlNumberList, viQuestion)
  262.       deleteOne(vlNumberList, viQuestion)
  263.       addProp(plpTestQuestions, viChapter, viQuestion)
  264.     end repeat
  265.   end repeat
  266.   plpTestQuestions = RandomizePropertyList(plpTestQuestions, piNumQuestions)
  267. end
  268.  
  269. on mStartNewQuestion me
  270.   member("question_num").text = string(piCurQuestion)
  271.   piCurChapter = getPropAt(plpTestQuestions, piCurQuestion)
  272.   piCurChapterQuestion = getAt(plpTestQuestions, piCurQuestion)
  273.   psChapterQuestions = member(IntegerToString(piCurChapter, pkMaxDigits)).text
  274.   vsQuestion = line piCurChapterQuestion of psChapterQuestions
  275.   vlAnswerOrder = getAt(plQuestionsAnswerOrder, piCurQuestion)
  276.   vlAnswerOrder = mSetQuestionData(poQuestionTemplate, vsQuestion, vlAnswerOrder)
  277. end
  278.  
  279. on mResetAnsweredQuestion me
  280.   viWhich = getAt(plFirstAnswer, piCurQuestion)
  281.   if pzEvalType = #quiz then
  282.     mMarkAnswer(poQuestionTemplate, viWhich)
  283.   end if
  284.   if viWhich then
  285.     mSelectAnswer(poQuestionTemplate, viWhich)
  286.   end if
  287. end
  288.  
  289. on mReviewAQuestion me, xiNextQuestion
  290.   piCurQuestion = xiNextQuestion
  291.   mStartNewQuestion(me)
  292.   mSetFromChapter(poQuestionTemplate, getPropAt(plpTestQuestions, piCurQuestion))
  293.   mShowAnswer(poQuestionTemplate)
  294.   viWhich = getAt(plFirstAnswer, piCurQuestion)
  295.   mSelectAnswer(poQuestionTemplate, viWhich)
  296.   mMarkAnswer(poQuestionTemplate, viWhich)
  297.   mDisable(poQuestionTemplate, 1)
  298. end
  299.  
  300. on mDisplaySummary me
  301.   mInitBkg(me, string(pzEvalType) & "SummaryBG")
  302.   piFirstSummarySprite = mGetLastDotGiven(poDotMan)
  303.   set the ink of sprite piFirstSummarySprite to 0
  304.   if pzEvalType = #quiz then
  305.     mInitReviewQuestionBtns(me)
  306.   else
  307.     mInitReviewScrollText(me)
  308.   end if
  309.   viSprite = mGiveDot(poDotMan)
  310.   member("total_correct").text = string(piTotalCorrect)
  311.   set the member of sprite viSprite to "total_correct"
  312.   AlignTextBoxToSpacer(viSprite, "summaryTotalCorrectSpacer")
  313.   set the ink of sprite viSprite to 36
  314.   viSprite = mGiveDot(poDotMan)
  315.   member("total_correct_percentage").text = string(integer(100 * piTotalCorrect / piNumQuestions))
  316.   set the member of sprite viSprite to "total_correct_percentage"
  317.   AlignTextBoxToSpacer(viSprite, "TotalCorrectPercentageSpacer")
  318.   set the ink of sprite viSprite to 36
  319.   viSprite = mGiveDot(poDotMan)
  320.   poPrintBtn = InitPopBtn(me, viSprite, "Print" & string(pzEvalType) & "Results", #mPrintBtnClick, #result, "clickSnd")
  321.   piLastSummarySprite = mGetLastDotGiven(poDotMan)
  322. end
  323.  
  324. on mDonePrint
  325.   mSetState(poPrintBtn, #Up)
  326.   mDisable(poPrintBtn, 0)
  327.   if poStartBtn <> VOID then
  328.     mSetState(poStartBtn, #Up)
  329.     mDisable(poStartBtn, 0)
  330.   end if
  331.   cursor(0)
  332. end
  333.  
  334. on mHandleNumQuestions me, xiID
  335.   piNumQuestions = xiID * 20
  336. end
  337.  
  338. on mHandleChapterSelectionClick me, xiChapter
  339.   piCurChapter = xiChapter
  340.   if mGetState(poStartBtn) = #gray then
  341.     mSetState(poStartBtn, #Up)
  342.     mDisable(poStartBtn, 0)
  343.     mSetState(poPrintBtn, #Up)
  344.     mDisable(poPrintBtn, 0)
  345.   end if
  346. end
  347.  
  348. on mHandlePrintBtnClick me, xzWhich
  349.   mSetState(poPrintBtn, #gray)
  350.   mDisable(poPrintBtn, 1)
  351.   if poStartBtn <> VOID then
  352.     mSetState(poStartBtn, #gray)
  353.     mDisable(poStartBtn, 1)
  354.   end if
  355.   cursor(4)
  356.   if not voidp(poChapterBtnGroup) then
  357.     pliChapters = mGetChosenID(poChapterBtnGroup)
  358.   end if
  359.   if ilk(pliChapters) <> #list then
  360.     pliChapters = [pliChapters]
  361.   end if
  362.   if mTotalNumQuestionsAvailable(me) < piNumQuestions then
  363.     alert("You have chosen too many questions for the number of chapters selected.")
  364.     pliChapters = []
  365.   else
  366.     if xzWhich = #clean then
  367.       mInitQuestionData(me)
  368.       mSelectQuestions(me)
  369.     end if
  370.     mSetHeaderFooter(poPrintEvaluation, pliChapters, string(pzEvalType), piNumQuestions)
  371.     mPrintEvaluation(poPrintEvaluation, xzWhich, plpTestQuestions, plQuestionsAnswerOrder, plFirstAnswer, plRightWrong)
  372.   end if
  373. end
  374.  
  375. on mTotalNumQuestionsAvailable me
  376.   viTotalAvailable = 0
  377.   repeat with i = 1 to count(pliChapters)
  378.     vsMemberName = IntegerToString(getAt(pliChapters, i), 2)
  379.     viNum = the number of lines in the text of member vsMemberName
  380.     viTotalAvailable = viTotalAvailable + viNum
  381.   end repeat
  382.   return viTotalAvailable
  383. end
  384.  
  385. on mHandleStartBtnClick me
  386.   pliChapters = mGetChosenID(poChapterBtnGroup)
  387.   if ilk(pliChapters) <> #list then
  388.     pliChapters = [pliChapters]
  389.   end if
  390.   if mTotalNumQuestionsAvailable(me) < piNumQuestions then
  391.     alert("You have choosen too many questions for the number of chapters selected.")
  392.     pliChapters = []
  393.   else
  394.     mClearChapterSelection(me)
  395.     mInitQuestions(me)
  396.     mInitNumberFields(me)
  397.     mInitButtons(me, pzEvalType, "prev", "next")
  398.     mSetButtonState(me)
  399.   end if
  400. end
  401.  
  402. on mHandleShowAnswer me
  403.   mShowAnswer(poQuestionTemplate)
  404. end
  405.  
  406. on mHandleDoneTest me
  407.   mHide(poNext)
  408.   mHide(poPrev)
  409.   mSetMemberName(poTop, string(pzEvalType) & "Summary")
  410.   mSetEvent(poTop, #returnToSummary)
  411.   mDisplaySummary(me)
  412. end
  413.  
  414. on mHandleTopBtnClick me, xzTop
  415.   case xzTop of
  416.     #newQuiz, #newTest:
  417.       pliChapters = []
  418.       set the text of field "curChoice" to "20"
  419.       set the text of field "testRightScroll" to EMPTY
  420.       set the text of field "testWrongScroll" to EMPTY
  421.       member("fromChapterText").text = EMPTY
  422.       deleteOne(the actorList, poRightQuestions)
  423.       deleteOne(the actorList, poWrongQuestions)
  424.       mInitSprites(me)
  425.       puppetTransition(3, 2, 2, 1)
  426.   end case
  427. end
  428.  
  429. on mHandlePrevBtnClick me, xOpcode
  430.   if piCurQuestion = 1 then
  431.     mNotify(poOwner, #mQuizToStage)
  432.   else
  433.     piCurQuestion = piCurQuestion - 1
  434.     mStartNewQuestion(me)
  435.     mResetAnsweredQuestion(me)
  436.     mSetButtonState(me)
  437.   end if
  438. end
  439.  
  440. on mHandleNextBtnClick me, xOpcode
  441.   if piCurQuestion < piNumQuestions then
  442.     piCurQuestion = piCurQuestion + 1
  443.     mStartNewQuestion(me)
  444.     mResetAnsweredQuestion(me)
  445.     mSetButtonState(me)
  446.   else
  447.     if voidp(poOwner) then
  448.       mHide(poNext)
  449.       mHide(poPrev)
  450.       mSetMemberName(poTop, string(pzEvalType) & "Summary")
  451.       mSetEvent(poTop, #returnToSummary)
  452.       mDisplaySummary(me)
  453.     end if
  454.   end if
  455. end
  456.  
  457. on mHandleQuizWrong me, xiAnswer
  458.   if getAt(plRightWrong, piCurQuestion) = EMPTY then
  459.     piNumQuestonsAnswered = piNumQuestonsAnswered + 1
  460.     mSetButtonState(me)
  461.     setAt(plFirstAnswer, piCurQuestion, xiAnswer)
  462.     setAt(plRightWrong, piCurQuestion, "wrong")
  463.   end if
  464. end
  465.  
  466. on mHandleQuizRight me, xiAnswer
  467.   if getAt(plRightWrong, piCurQuestion) = EMPTY then
  468.     piNumQuestonsAnswered = piNumQuestonsAnswered + 1
  469.     setAt(plFirstAnswer, piCurQuestion, xiAnswer)
  470.     setAt(plRightWrong, piCurQuestion, "right")
  471.     piTotalCorrect = piTotalCorrect + 1
  472.     member("total_correct").text = string(piTotalCorrect)
  473.     mSetButtonState(me)
  474.   end if
  475. end
  476.  
  477. on mHandleTestWrong me, xiAnswer
  478.   if getAt(plRightWrong, piCurQuestion) = EMPTY then
  479.     piNumQuestonsAnswered = piNumQuestonsAnswered + 1
  480.   end if
  481.   if getAt(plRightWrong, piCurQuestion) = "right" then
  482.     piTotalCorrect = piTotalCorrect - 1
  483.   end if
  484.   setAt(plFirstAnswer, piCurQuestion, xiAnswer)
  485.   setAt(plRightWrong, piCurQuestion, "wrong")
  486. end
  487.  
  488. on mHandleTestRight me, xiAnswer
  489.   if getAt(plRightWrong, piCurQuestion) = EMPTY then
  490.     piNumQuestonsAnswered = piNumQuestonsAnswered + 1
  491.   end if
  492.   if getAt(plRightWrong, piCurQuestion) <> "right" then
  493.     piTotalCorrect = piTotalCorrect + 1
  494.   end if
  495.   setAt(plFirstAnswer, piCurQuestion, xiAnswer)
  496.   setAt(plRightWrong, piCurQuestion, "right")
  497. end
  498.  
  499. on mHandleQuestionReview me, xiQuestion
  500.   mResetDots(poDotMan, piFirstSummarySprite, piLastSummarySprite)
  501.   mReviewAQuestion(me, xiQuestion)
  502. end
  503.  
  504. on mHandleScrollingList me, xiID
  505.   if xiID = 1 then
  506.     vsLine = mGetMouseLine(poRightQuestions)
  507.     mSetLineColour(poRightQuestions, the foreColor of member "textHiliteColour")
  508.   else
  509.     vsLine = mGetMouseLine(poWrongQuestions)
  510.     mSetLineColour(poWrongQuestions, the foreColor of member "textHiliteColour")
  511.   end if
  512.   if not ((vsLine = EMPTY) or (vsLine = VOID)) then
  513.     vsNum = char offset(" ", vsLine) + 1 to offset("-", vsLine) - 2 of vsLine
  514.     mHide(poRightQuestions)
  515.     mHide(poWrongQuestions)
  516.     deleteOne(the actorList, poRightQuestions)
  517.     deleteOne(the actorList, poWrongQuestions)
  518.     mResetDots(poDotMan, piFirstSummarySprite, piLastSummarySprite)
  519.     mReviewAQuestion(me, integer(vsNum))
  520.   end if
  521. end
  522.  
  523. on mHandleReturnToSummary me
  524.   mDisplaySummary(me)
  525. end
  526.  
  527. on mPrintEvaluation me, xzWhich
  528.   viNumChapters = count(pliChapters)
  529.   vsChapter = "<center>Chapter "
  530.   if viNumChapters > 1 then
  531.     vsChapter = "<center>Chapters: "
  532.   end if
  533.   vsChapterNum = getAt(pliChapters, 1)
  534.   repeat with i = 2 to viNumChapters
  535.     vsChapterNum = vsChapterNum & ", " & getAt(pliChapters, i)
  536.   end repeat
  537.   vsEvaluation = string(pzEvalType) & "#RETURN" & vsChapter & vsChapterNum & " " & string(pzEvalType) & "</center><BR><BR><BR><OL>"
  538.   vlLetters = ["a", "b", "c", "d", "e"]
  539.   vsOld = the itemDelimiter
  540.   the itemDelimiter = TAB
  541.   viCurline = 3
  542.   repeat with i = 1 to piNumQuestions
  543.     viCurChapter = getPropAt(plpTestQuestions, i)
  544.     viCurChapterQuestion = getAt(plpTestQuestions, i)
  545.     vsChapterQuestions = member(IntegerToString(viCurChapter, pkMaxDigits)).text
  546.     vsAQuestion = line viCurChapterQuestion of vsChapterQuestions
  547.     vlAnswerOrder = getAt(plQuestionsAnswerOrder, i)
  548.     vsResult = getAt(plRightWrong, i)
  549.     vsEvaluation = vsEvaluation & "<LI>" & item 1 of vsAQuestion & "<BR><BR>"
  550.     if xzWhich = #clean then
  551.       vsEvaluation = vsEvaluation & "<OL TYPE=" & "a" & ">"
  552.     else
  553.       vsEvaluation = vsEvaluation & "<OL>"
  554.     end if
  555.     delete item 1 of vsAQuestion
  556.     if item 1 of vsAQuestion <> EMPTY then
  557.       vlAnswerOrder = GetListFrom1toX(piNumAnswers)
  558.       viRight = value(item 1 of vsAQuestion)
  559.     else
  560.       viRight = 1
  561.     end if
  562.     delete item 1 of vsAQuestion
  563.     case xzWhich of
  564.       #clean:
  565.         repeat with j = 1 to the number of items in vsAQuestion
  566.           viWhichAnswer = getAt(vlAnswerOrder, j)
  567.           vsEvaluation = vsEvaluation & "<LI>" & item viWhichAnswer of vsAQuestion
  568.         end repeat
  569.       #result:
  570.         viAnswer = getAt(plFirstAnswer, i)
  571.         viLetterPos = getPos(vlAnswerOrder, viAnswer)
  572.         if viLetterPos then
  573.           vsEvaluation = vsEvaluation & "Your Answer: " & getAt(vlLetters, viLetterPos) & ") " & item viAnswer of vsAQuestion & "<BR><BR>"
  574.         end if
  575.         if vsResult <> "right" then
  576.           vsEvaluation = vsEvaluation & "Correct Answer: " & getAt(vlLetters, getPos(vlAnswerOrder, viRight)) & ") " & item viRight of vsAQuestion
  577.         end if
  578.     end case
  579.     vsEvaluation = vsEvaluation & "</OL><BR><BR>"
  580.   end repeat
  581.   vsEvaluation = vsEvaluation & "</OL>"
  582.   the itemDelimiter = vsOld
  583.   alert("The new window will take a moment to open.")
  584.   gotoNetPage("javascript:doPrintable(" & QUOTE & vsEvaluation & QUOTE & ")")
  585. end
  586.  
  587. on mHandleCloseBtn me
  588.   sound close 1
  589. end
  590.  
  591. on mNotify me, xiEvent, xOpcode
  592.   case xiEvent of
  593.     #chapterSelectionClick:
  594.       mHandleChapterSelectionClick(me, xOpcode)
  595.     #numQuestionsRadioBtn:
  596.       mHandleNumQuestions(me, xOpcode)
  597.     #mStartBtnClick:
  598.       mHandleStartBtnClick(me, xOpcode)
  599.     #mPrintBtnClick:
  600.       mHandlePrintBtnClick(me, xOpcode)
  601.     #showAnswer:
  602.       mHandleShowAnswer(me, xOpcode)
  603.     #donetest:
  604.       mHandleDoneTest(me, xOpcode)
  605.     #mPrevBtnClick:
  606.       mHandlePrevBtnClick(me, xOpcode)
  607.     #mNextBtnClick:
  608.       mHandleNextBtnClick(me, xOpcode)
  609.     #quizwrong:
  610.       mHandleQuizWrong(me, xOpcode)
  611.     #quizright:
  612.       mHandleQuizRight(me, xOpcode)
  613.     #testright:
  614.       mHandleTestRight(me, xOpcode)
  615.     #testwrong:
  616.       mHandleTestWrong(me, xOpcode)
  617.     #questionReview:
  618.       mHandleQuestionReview(me, xOpcode)
  619.     #TextFieldMouseDown:
  620.       mHandleScrollingList(me, xOpcode)
  621.     #returnToSummary:
  622.       mHandleReturnToSummary(me)
  623.     #close:
  624.       mHandleCloseBtn(me, xOpcode)
  625.     #printDone:
  626.       mDonePrint(me)
  627.   end case
  628. end
  629.  
  630. on mCleanUp me
  631.   if not voidp(poQuestionTemplate) then
  632.     mCleanUp(poQuestionTemplate)
  633.   end if
  634.   poQuestionTemplate = VOID
  635.   mResetDots(poDotMan)
  636.   poDotMan = VOID
  637.   plRightWrong = []
  638.   plQuestionsAnswerOrder = []
  639.   plFirstAnswer = []
  640.   pliChapters = []
  641.   poNumQuestionsRadio = VOID
  642.   plpTestQuestions = []
  643.   poRightQuestions = VOID
  644.   poWrongQuestions = VOID
  645. end
  646.